<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            text-align: center;
            border: 2px solid #000;
            border-radius: 20px;
            padding: 10px;
            display: inline-block;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="box">
            <h3>自动售货机</h3>
            <button @click="buy(5)">可乐5元</button>
            <button v-on:click="buy(10)">咖啡10元</button>
        </div>
        <p>银行卡余额: {{ moneny }}元</p>
    </div>
    
    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                moneny: 100
            },
            methods :{
                buy(num) {
                    this.moneny -= num
                }
            }
        })
    </script>
</body>
</html>